﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Net;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Navigation;
using INdTFramework.Commons;
using Microsoft.Phone.Controls;
using Microsoft.Phone.Shell;

namespace CriptographySample
{
    public partial class Sha256Page : PhoneApplicationPage
    {
        public Sha256Page()
        {
            InitializeComponent();
        }

        private void GenerateClicked(object sender, RoutedEventArgs e)
        {
            txtHash.Text = EncryptionUtils.GetHashBySHA256(txtOriginal.Text);
        }

        private void ValidatedClicked(object sender, RoutedEventArgs e)
        {
            String hash = EncryptionUtils.GetHashBySHA256(txtOriginal.Text);

            if (hash.Equals(txtHash.Text))
                MessageBox.Show("Valid message!");
            else
                MessageBox.Show("Invalid message!");
        }
    }
}